home *** CD-ROM | disk | FTP | other *** search
/ PC-SIG: World of Education / PC-SiG's World of Education.iso / run / 2602 / function.hlp < prev    next >
Encoding:
Text File  |  1989-06-03  |  4.3 KB  |  97 lines

  1. Functions transform input values and return a single value.  Use
  2. functions in expressions any place a variable would be legal.
  3.  
  4. DAN recognizes two types of functions; regular functions whose value is
  5. independent of any previous processing, and sequential functions whose
  6. returned value depends on the values previously passed to the function
  7. during the current implicit loop.
  8.  
  9. Sequential functions produce running values derived from the data
  10. received so far in the implicit loop where they are invoked.  They have
  11. no "foreknowledge" of succeeding values.  Each sequential function,
  12. except READ, requires one Symbol Table entry for each invocation to use
  13. as a scratch pad area.
  14. +
  15. Regular Functions
  16. -----------------
  17.    SIN(expr)                COS(expr)
  18.    TAN(expr)                SINH(expr)
  19.    COSH(expr)               ARCSIN(expr)
  20.    ARCCOS(expr)             ARCTAN(expr)
  21.    ARCSINH(expr)            ARCCOSH(expr)
  22.    LN(expr)                 LOG(expr)
  23.    EXP(expr)                EXP10(expr)
  24.    SQRT(expr)               ABS(expr)
  25.    RAND(expr)               D.TO.R(expr)
  26.    R.TO.D(expr)             DIGITAL(expr)
  27.    DAC(chan,expr)           DIGOUT(expr)
  28.    ANALOG(expr)             TIME
  29.    TODAY                    ERF(expr)
  30.    GAMMA(expr)              BESSJ(orderexpr,expr)
  31.    BESSY(orderexpr,expr)    FFTRE(freqexpr)
  32.    FFTIM(freqexpr)          FFTMAG(freqexpr)
  33.    FFTPHS(freqexpr)         BIN(expr)
  34.    PULSE(strtme,endtme)     LIMIT(loexpr,expr,hiexpr)
  35. +
  36. Sequential Functions
  37. --------------------
  38.    INTEGRAL (expr)      AVG (expr)
  39.    DERIV (expr)         SUM (expr)
  40.    DELTA (expr)         STD.DEV (expr)
  41.    PREV (expr)          COUNT (expr)
  42.    MIN (expr)           TIMEOUT (loexpr,testexpr,hiexpr)
  43.    MAX (expr)           TIMEIN (loexpr,testexpr,hiexpr)
  44.    READ
  45. +
  46. Function Notes
  47.  
  48. Derivatives applied to sampled values are highly sensitive to noise. 
  49. Imagine a flat line being approximated by samples that are alternately
  50. one count above and below the line.  The samples nowhere differ from
  51. the actual line by more than one count but the derivative, which should
  52. be zero, will oscillate between positive and negative values and will
  53. never be zero.  Small step sizes tend to accentuate this effect.  It is
  54. recommended that the DERIV function only be applied to variables that
  55. were created with smoothing enabled and a large step size.
  56. +
  57. Use the TIMEOUT and TIMEIN functions to automatically determine the
  58. start time for significant data.  For example, suppose the file
  59. ACTUAL.ACC contains acceleration data for a vehicle starting from rest
  60. and PREDICT.ACC contains predicted acceleration values (in G's) for the
  61. vehicle:
  62.  
  63.      START=TIMEOUT(-.1,ACTUAL.ACC-PREDICTED.ACC,.1)-.005;
  64.  
  65. sets the start time for subsequent processing to 5 milliseconds before
  66. the difference between the measured and predicted accelerations exceeds
  67. .1 G's.
  68. +
  69. If 'testexpr' never breaks out of the specified bounds in the
  70. current processing period then the value returned is the first step
  71. time.  Note that this function is applied only to values in the
  72. current processing period (i.e. as defined by START, BIAS, and
  73. DUR).  The accuracy of this function is dependent on the step size
  74. since the out of bounds test is only made on the expression values
  75. at each step time.  The values chosen for the lower and upper
  76. bounds should allow for noise in the sampled values.  In the above
  77. example, the user is really interested in starting when the
  78. predicted value is not equal to the measured acceleration. 
  79. However, lower and upper bounds of 0, while legal, would probably
  80. cause the start time to be set too early.
  81. +
  82. Note that AVG, SUM, COUNT, and STD.DEV will be invoked at each step
  83. time and thus will give the average/ sum/ count/ standard deviation of
  84. 'expr' values over all step times, not just at the actual data points
  85. in a file, unless you are running with INTERP=OFF.
  86.  
  87. If you do a PLOT(READ) statement, DAN will draw the plot grid and label
  88. the fiducials after the first data point has been input.  The program
  89. does not know at this time the processing span in the file being READ
  90. and hence will use the current DUR value (which may be considerably
  91. different than the duration of the data points in the file).  To get
  92. around this limitation, either set the correct duration (if you know
  93. it), or do the following:
  94.  
  95.      filename = READ & SCALEY(filename);
  96.      PLOT(filename);
  97.